import { defineStore } from 'pinia'
import { useRequest } from '~/composables/useRequest'

export const useHomeStore = defineStore('homeStore', () => {
  const { requestGet, requestPost } = useRequest()
  const state = reactive({
    discountGoodsList: [],
  })

  return {
    ...toRefs(state),
    async initDisCountList() {
      const { data } = await requestGet('/app/home/allSpecialDeals', {})
      state.discountGoodsList = data
    },
    async initSpecialDealList(isDiscounted: any) {
      const { data } = await requestGet(`/app/home/showcaseSpecialDeals/?isDiscounted=${isDiscounted}`)
      return data
    },
  }
})
